package com.seeyon.apps.wpscoordination.controller;



import cn.hutool.http.HttpRequest;
import com.seeyon.apps.wpscoordination.common.JsonResult;
import com.seeyon.apps.wpscoordination.dto.CardTextUrlMessageDto;
import com.seeyon.apps.wpscoordination.service.ISendMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/wpsMessage")
public class SendMessageController {

    @Autowired
    private ISendMessageService sendMessageService;

    @PostMapping("/sendTextMessage")
    public Map<String, Object> SendTextMessage(@RequestBody CardTextUrlMessageDto dto) throws Exception {
       Boolean isOk = sendMessageService.SendCardTextUrlMessage(dto);
       JsonResult jsonResult=new JsonResult();
       if(isOk){
           jsonResult.setCode(200);
           jsonResult.setMsg("消息发送成功");
       }else {
           jsonResult.setCode(10001);
           jsonResult.setMsg("消息发送失败");
       }
       return jsonResult.getMap();
    }
}
